const AbstractPersistor = require('./AbstractPersistor')
const PersistorHelper = require('./PersistorHelper')

const fs = require('fs')
const COS = require('cos-js-sdk-v5')
const { URL } = require('url')
const {
  WriteError,
  ReadError,
  NotFoundError,
  SettingsError
} = require('./Errors')

module.exports = class COSPersistor extends AbstractPersistor {
  constructor(settings = {}) {
    super();

    this.settings = settings;
  }

  async sendFile(bucketName, key, fsPath) {

  }

  async sendStream(bucketName, key, readStream, opts = {}) {

  }

  async getObjectStream(bucketName, key, opts) {

  }

  async getRedirectUrl(bucketName, key) {

  }

  async deleteDirectory(bucketName, key, continuationToken) {

  }

  async getObjectSize(bucketName, key) {

  }

  async getObjectMd5Hash(bucketName, key) {

  }

  async deleteObject(bucketName, key) {

  }

  async copyObject(bucketName, sourceKey, destKey) {

  }

  async checkIfObjectExists(bucketName, key) {

  }

  async directorySize(bucketName, key, continuationToken) {

  }

  _getClientForBucket(bucket, clientOptions) {

  }

  _buildClientOptions(bucketCredentials, clientOptions) {

  }

  static _md5FromResponse(response) {
    const md5 = (response.ETag || '').replace(/[ "]/g, '')
    if (!md5.match(/^[a-f0-9]{32}$/)) {
      return null
    }

    return md5
  }
}